import os
from multiprocessing import Process, Manager
import numpy as np
import signal
import time
from itertools import product
import subprocess

# parameter analysis for SAGloss

import tool

# step 1
r_e_list = [1.0]
r_p_list = [0.01, 0.1, 1, 10]
enlarge_list = [50]
perplexity_list = [10, 50, 100,]
embdim_list = [50, 100, 200]
v_list = [0.001, 0.002, 0.005,]
dropedgerate_list = [0, 0.001, 0.005, 0.01]
batch_size_list = [3327]



# step 2
v_list = [0.0034, 0.0036, 0.004, 0.0045]
embdim_list = [200, 300]
perplexity_list = [50,60,70,80, 100,]
r_e_list = [1.0]
r_p_list = [0.4, 0.5,0.6,0.8,1.0]
enlarge_list = [50]
dropedgerate_list = [0, 0.001, 0.005, 0.01]
batch_size_list = [3327]

# step 3
v_list = [0.0034, 0.00345, 0.0035, 0.00355,0.036]
embdim_list = [200, 300]
perplexity_list = [50,60,70,80, 100,]
r_e_list = [1.0]
r_p_list = [0.4,0.43,0.45,0.47,0.5]
enlarge_list = [50]
dropedgerate_list = [0, 0.001, 0.005, 0.01]
batch_size_list = [3327]


# step 4
v_list = [0.0033, 0.00335, 0.0034, 0.00345, 0.0035]
embdim_list = [200, 210]
perplexity_list = [100,120,140]
r_e_list = [1.0]
r_p_list = [0.39, 0.4, 0.41, 0.43]
enlarge_list = [50]
dropedgerate_list = [0, 0.001, 0.005, 0.01]
batch_size_list = [3327]

cudalist = [
    0,
    1,
    2,
    3,
    4,
    5,
    6,
    7,
]

changeList = [batch_size_list, v_list,dropedgerate_list, embdim_list, perplexity_list, enlarge_list, r_e_list, r_p_list]
paramName = ['batch_size','v', 'dropedgerate', 'embdim', 'perplexity', 'enlarge', "r_e", "r_p", ]
mainFunc = "./main_graph_citseer.py"
ater = tool.AutoTrainer(
    changeList,
    paramName,
    mainFunc,
    deviceList=cudalist,
    poolNumber=1*len(cudalist),
    name="autotrain",
    waittime=0.1,
)
ater.Run()
